import Vue from 'vue'
import App from './App.vue'
import  Axios from 'axios'
import  VueAxios from 'vue-axios'
import ElementUI from 'element-ui'
import {Message} from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
//俩副配置文件
import router from './router'
import store from './store'

Axios.defaults.baseURL="http://localhost:9090";
Axios.interceptors.response.use((res)=>{return res},
    (error => {
      if (error && error.response){
        switch (error.response.status) {
          case 404:{
            Message.warning({message:error.response.data});
            break;
          }
          case 820:{
            Message.warning({message:error.response.data});
            router.push("/consumer/personAdd")
            break;
          }
          case 888:{
            Message.warning({message:error.response.data});

            router.push("/consumer/personAdd")

            break;
          }
          case 930:{
            Message.warning({message:"filter权限拦截："+error.response.data});
            break;
          }
          case 960:{
            Message.warning({message:"filter用户名密码不匹配："+error.response.data});
            break;
          }
          case 961:{
            Message.warning({message:"filter账号已经被冻结："+error.response.data});
            break;
          }
          case 962:{
            Message.warning({message:"filter用户名找不到："+error.response.data});
            break;
          }
          case 990:{
            Message.warning({message:"filter非正常用户非临时用户："+error.response.data});
            break;
          }
          case 999:{
            Message.warning({message:"controller未定异常："+error.response.data});
            break;
          }
          case 1024:{
            Message.warning({message:"controller保底异常捕获："+error.response.data})
            break;
          }




        }
      }
      // return error;
      // return Promise.resolve(error);
      return Promise.reject(error)

    }));
Axios.defaults.withCredentials=true;
Vue.use(VueAxios,Axios);
Vue.use(ElementUI);

Vue.config.productionTip = false;
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
